package edu.hubu.work01.controller;


import edu.hubu.work01.entity.Cowshed;
import edu.hubu.work01.Service.CowshedService;
import edu.hubu.work01.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class CowshedController {
    @Autowired
    private CowshedService cowshedService;


    @RequestMapping("/cowshed/add")
    public ResultVO add(Cowshed cowshed){
        return cowshedService.saveCowshed(cowshed);
    }
    @RequestMapping("/cowshed/delete")
    public ResultVO delete(int cshdId){
        return cowshedService.removeCowshed(cshdId);

    }
    @RequestMapping("/cowshed/select")
    public ResultVO select(int cshdId){
        return cowshedService.selectById(cshdId);
    }
    @RequestMapping("/cowshed/selects")
    public ResultVO selects(int userId){
        return cowshedService.selectByUserId(userId);
    }
}